home *** CD-ROM | disk | FTP | other *** search
- Path: yama.mcc.ac.uk!usenet
- From: Dan <dan@ap.co.umist.ac.uk>
- Newsgroups: comp.lang.c
- Subject: Call by ref of int's
- Date: Tue, 27 Feb 1996 13:22:22 +0000
- Organization: umist
- Message-ID: <3133058E.41C67EA6@ap.co.umist.ac.uk>
- NNTP-Posting-Host: engels.ap.co.umist.ac.uk
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (X11; I; SunOS 4.1.3_U1 sun4c)
-
- I have a problem with my program;
-
- I am writing a 3d engine and I have to read in from a txt file into
- a struct, and push each struct onto a stack.
-
- When I pop the stack, I call;
-
- pop_facet(&facet_current, &a, &b, &c)
-
- where facet_current is struct facet
- {
- int edge[3][2];
- struct facet *next_f;
- }
-
- and the in the actual function;
-
- void pop_facet(struct facet **facet_current, int *a, int *b, int *c)
- {
- .
- .
- .
- *a = new_facet->edge[0][0];
- *b = new_facet->edge[0][1]; these will only be between 1 and 8
- *c = new_facet->edge[1][0];
- }
-
- the problem is the &a,b,c 's i get don't produce meaningful numbers
- from an array vertex[8][3]
-
- vertex[(a-1)][0]
- vertex[(a-1)][1]
- .
-
- vertex[(b-1)][0]
- .
- .
- etc...
-
- the array vertex should only have +50 or -50 in any element but I keep
- getting results like -9843 and 12343
-
- what's going on???
- ---------------------------------
- dan@ap.co.umist.ac.uk
-
- "If all the world's a stage....
- then Steven Fry's f***ed!!"
-
- GAME ON!
- ---------------------------------
-